import cgi
import os

os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
from google.appengine.dist import use_library
use_library('django', '1.1')

from google.appengine.ext import webapp
from google.appengine.ext.webapp import template
from google.appengine.ext.webapp.util import run_wsgi_app

from django.utils import simplejson

class LabsHandler(webapp.RequestHandler):
  def get(self):
    self.response.headers['content-type'] = 'text/plain'
    
    testOb = {}
    testOb["tierName"] = "Icecrown Citadel"
    
    jsonStr = simplejson.dumps(testOb)
    
    self.response.out.write(jsonStr)
    self.response.out.write("\n")
    
    newOb = simplejson.loads(jsonStr)
    self.response.out.write("tierName: %s" % newOb["tierName"] )

def main():
  application = webapp.WSGIApplication(
                                        [('/labs', LabsHandler)],
                                        debug=True)
  
  run_wsgi_app(application)


if __name__ == '__main__':
  main()